package com.zzy.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 该类⽤于模拟，我们要使⽤共享的那些配置信息做⼀些事情
 */
@RestController
@RequestMapping("/config")
@RefreshScope
public class ConfigController {
    // 和取本地配置信息⼀样
    @Value("${data.url}")
    private String url;
    @Value("${data.username}")
    private String username;
    // 内存级别的配置信息
// 数据库， redis配置信息
    @GetMapping("/viewconfig")
    public String viewconfig() {
        return "url==>" + url + " username=>" +
                username;
    }
}
